package com.cxd.batch.util;

import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.util.LinkedHashMap;
import java.util.Map;

import org.apache.commons.dbutils.handlers.MapListHandler;

/**
 * <一句话功能简述> <功能详细描述>
 * @author wtj
 * @date 2015年12月24日 下午3:02:36
 * @company CXD
 * @version [Copyright (c) 2015 V001]
 */
public class LinkMapListHandler extends MapListHandler{
    @Override
    protected Map<String, Object> handleRow(ResultSet rs) throws SQLException {
        Map<String, Object> result = new LinkedHashMap<String, Object>();
        ResultSetMetaData rsmd = rs.getMetaData();
        int cols = rsmd.getColumnCount();
        for (int i = 1; i <= cols; i++) {
            result.put(rsmd.getColumnName(i), rs.getObject(i));
        }
        return result;
    }
}
